package org.walkerljl.boss.openservice.auth;

import org.springframework.stereotype.Service;
import org.walkerljl.boss.openservice.support.BaseSdkServiceImpl;
import org.walkerljl.boss.support.sdk.auth.AuthenticationService;
import org.walkerljl.boss.support.sdk.auth.enums.AuthObjectType;
import org.walkerljl.boss.support.sdk.Message;

/**
 * @author lijunlin
 */
@Service("authenticationService")
public class AuthenticationServiceImpl extends BaseSdkServiceImpl implements AuthenticationService {

    @Override
    public Message<Boolean> auth(AuthObjectType authObjectType, String authObjectId, String authCode) {
        String messagePrefix = "Do authentication";
        try {
            return toSuccessMessage(messagePrefix, true, authObjectType, authObjectId, authCode);
        } catch(Throwable e) {
            return toFailureMessage(messagePrefix, e, authObjectType, authObjectId, authCode);
        }
    }
}
